﻿using System;
using System.Collections.Generic;
using WebSocket4Net;
using System.Text;

namespace ICUConsole
{
    class Client
    {
        public static void ErrorProcessor(object sender, MessageReceivedEventArgs e)
        {
            if (e.Message.StartsWith("Error\n"))
            {
                ICU.Errors errors = (ICU.Errors)Convert.ToInt32(e.Message.Split('\n')[1]);
                Console.WriteLine("Error: {0}", errors.GetType().GetEnumName(errors));
            }
        }
        public static WebSocket GetEmail(string address, string host)
        {
            WebSocket webSocket = new WebSocket(host);
            webSocket.MessageReceived += ErrorProcessor;
            webSocket.Send("Register\n" + address + "\n\n");
            return webSocket;
        }
        public static string Register(string username,string password,WebSocket connection,out long id)
        {
            id = 0;
            return ("");
        }
    }
}
